package com.autolinq.service;

import org.apache.log4j.Logger;

import com.autolinq.pojo.WeChatMessage;

public class DPCAServiceFactory{
	Logger logger = Logger.getLogger(this.getClass().getName());
	public DPCAWechatService getService(WeChatMessage message){
		if (message.getMsgType().equals("device_type")||message.getMsgType().equals("device_text")) {
            logger.debug("WechatDeviceService");
            return new WechatDeviceService();
        }else if (message.getMsgType().equals("device_event")) {
        	logger.debug("WechatDeviceEventService");
            return new WechatDeviceEventService();
        }else if (message.getMsgType().equals("event")) {
			if (message.getEvent().equals("subscribe") || message.getEvent().equals("unsubscribe")) {// 此为关注/取消事件
				logger.debug("WechatNormalEventService");
				return new WechatNormalEventService();
			}else if (message.getEvent().toLowerCase().equals("click")) {
				logger.debug("WechatClickEventService");
				return new WechatClickEventService();
			}
        }else{
        	logger.debug("WechatClickEventService");
			return new WechatClickEventService();
        }
		return null;
	}
}